<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>WriteString</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">WriteString()</font></b></p>
<p><b>Syntax</b></p><blockquote>

Result = <font color="#006666"><b>WriteString</b></font>(#File, Text$ [, Format])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>



Write a string to a file. 

 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#File</i></td>
<td width="90%"> 
 
The file to write to. 

 

</td></tr>
<tr><td><i>Text$</i></td>
<td> 
 
The string to write. 

 

</td></tr>
<tr><td><i>Format (optional)</i></td>
<td> 
 
The format in which to write the string. It can be one of the following values: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Ascii</font>  : Writes the string in ASCII format
  <font color="#924B72">#PB_UTF8</font>   : Writes the string in UTF8 format
  <font color="#924B72">#PB_Unicode</font>: Writes the string in UTF16 format
</font></pre>

If this parameter is not specified, the string will be written in UTF8 format if the program is compiled in 
<a href="../reference/unicode.html">unicode</a> mode and in ASCII format otherwise. 

 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>



Returns nonzero if the operation was successful and zero if it failed. 

 

</blockquote><p><b>Remarks</b></p><blockquote>



Because of <a href="filebufferssize.html">file buffering</a>, this function may return successful even if there is not enough 
space left on the output device for the write operation. 
The file must be opened using a write-capable function (i.e. not with <a href="readfile.html">ReadFile()</a>). 
The null ending string character is not written to the file. 
<br>
<br>
To place a BOM (byte order mark) to later identify the string encoding format of a file 
use the <a href="writestringformat.html">WriteStringFormat()</a> function. 
To write a string including a newline sequence, use the <a href="writestringn.html">WriteStringN()</a> function. 
<br>
<br>
For an example see the <a href="createfile.html">CreateFile()</a> function. 

 

</blockquote><p><b>See Also</b></p><blockquote>

<a href="readstring.html">ReadString()</a>, <a href="writestringn.html">WriteStringN()</a>, <a href="writestringformat.html">WriteStringFormat()</a>, <a href="createfile.html">CreateFile()</a>, <a href="openfile.html">OpenFile()</a> 

</Blockquote><p><b>Supported OS  </b><Blockquote>All</Blockquote></p><center>&lt;- <a href=writequad.html>WriteQuad()</a> - <a href=index.html>File Index</a> - <a href=writestringformat.html>WriteStringFormat()</a> -&gt;



</body></html>